function earnings= car_earnings(t,x)
%出租车计费规则 x单位为km t为上车时间 
    v=60;

    
    if (0<x&&x<=3)
        earnings=9;
    elseif (x>3)
        earnings=9+2.4*x;
    end
    
    earnings=earnings+1;%加收一元燃油附加费
    
    %返空费 超过20公里，按实际执行车公里价的50%收取
    if x>20
        earnings=earnings+earnings*0.5;
    end
    
    % 23:00-次日5:00，按实际执行车公里价的20%收取
    if t>23||t<5
        earnings=earnings+(x/v)*0.2;
    end
end

